$(function() {

$.getJSON("plot_data.json", do_plot)

function do_plot(plot_data)
{
	$('#container').highcharts({
		chart: { type: 'area', zoomType: 'x' },		
		title: { text: 'Training Dashboard' },
		subtitle: { text: 'char-rnn' },

		xAxis: {
			// type: 'datetime',
			title: { text: null }
		},
		yAxis: { title: { text: 'Loss' }, },

		// legend: { enabled: false },

		plotOptions: {
			area: {
				fillColor: {
					linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, // shade
					stops: [
						[0, Highcharts.getOptions().colors[0]],
						[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
					]
				},
				lineWidth: 1, //设置线宽度 默认是： 2.

				states: { hover: { lineWidth: 1 } },
			}
		},

		series: plot_data, /* [{
			type: 'area',
			name: 'loss',
			data: plot_data */
			/* [
				// [ Date.UTC(1970, 1, 1, 0, 0, 0), 0.8446 ] ,
				// [ Date.UTC(1970, 1, 1, 1, 0, 0), 0.8445 ]
				%data_here
			] */
		// }] ,
		
		annotations: [{
			labels: [{
				point: [ Date.UTC(2020, 12, 25, 1, 39, 15), 83.115706 ],
				text: '二战期间冬奥会取消'
			}, {
				point: {
					x: 18,
					xAxis: 0,
					y: 90,
					yAxis: 0
				},
				text: '苏联解体，德国统一'
			}],
			labelOptions: {
				backgroundColor: 'rgba(255,255,255,0.5)',
				borderColor: 'silver'
			}
		}],
	});
}

});